﻿
Namespace PL.MESSDK
    Public Class RoutingSheet_PL
        Inherits PLBase

        Public Sub New()
            MyBase.New()
        End Sub

        Public Sub New(ByVal queryName As String)
            MyBase.New(queryName)
        End Sub

        Public Overrides Function Delete() As Boolean
            Return False
        End Function

        Public Overrides Function Validate() As Boolean
            Return True
        End Function

        Public Shared Sub SaveDiagramDocuments(ByVal routingSheetID As Guid, ByVal docStream As IO.MemoryStream, ByVal imageStream As IO.MemoryStream)
            Dim sqlcmd As System.Data.SqlClient.SqlCommand = Nothing
            If docStream IsNot Nothing Then
                sqlcmd = MetaQuery.GetSPCmdByMetaName("RoutingSheetDiagramDocuments_PL_Save")
                sqlcmd.Parameters("@RoutingSheetID").Value = routingSheetID
                docStream.Position = 0 ' Sinon vous savez-pas si vous sauver a partir du debut du stream
                sqlcmd.Parameters("@BinaryDiagram").Value = docStream.ToArray
                sqlcmd.Parameters("@BinaryImageDiagram").Value = imageStream.ToArray
                sqlcmd.ExecuteNonQuery()
                sqlcmd.Dispose()
            End If
        End Sub
    End Class
End Namespace
